@isTest
private class OppProductToReservation_TestClass 
{
    static testMethod void oppToReservations() 
    {
        Opportunity o = new Opportunity(name='Opp1231Sample', closedate = Date.today(), StageName = 'Closed Won');
        insert o;
        Product2[] prod = [select id, name from Product2 limit 1];
        PricebookEntry pbe = [select id, Product2Id  from PricebookEntry where Product2Id = :prod[0].Id limit 1];
        OpportunityLineItem[] oliList = new OpportunityLineItem[]{};
        for(Integer i = 0; i < 200; i++)
        {
            OpportunityLineItem oli = new OpportunityLineItem(Quantity = 1, PricebookEntryId=pbe.Id, OpportunityId=o.Id, TotalPrice=1000);        
            oliList.add(oli); 
        }
        insert oliList;
        
        for(OpportunityLineItem[] oliList2: [select quantity, make_good__c from OpportunityLineItem where opportunityid = :o.id ])
        {
            for(opportunitylineitem oli2: oliList2)
            {
                oli2.make_good__c = true;
            }
            update oliList2;
        }
       /*
       OpportunityLineItem[] oliList = [select Opportunityid, Make_Good__c, pricebookentry.product2.id from OpportunityLineItem order by createddate desc limit 1];
       oliList[0].make_good__c = false;
       update oliList; 
       */
       
      /* for(OpportunityLineItem oli: oliList)
       {
           oli.Make_good__c = true;
       }
       upsert oliList;*/
    }

    static testMethod void deleteOLI() 
    {
        Opportunity o = new Opportunity(name='Opp1231Sample1', closedate = Date.today(), StageName = 'Closed Won');
        insert o;
        Product2[] prod = [select id, name from Product2 limit 1];
        PricebookEntry pbe = [select id, Product2Id  from PricebookEntry where Product2Id = :prod[0].Id limit 1];
        OpportunityLineItem[] oliList = new OpportunityLineItem[]{};
        for(Integer i = 0; i < 1; i++)
        {
            OpportunityLineItem oli = new OpportunityLineItem(Quantity = 1, PricebookEntryId=pbe.Id, OpportunityId=o.Id, TotalPrice=1000);        
            oliList.add(oli); 
        }
        insert oliList;
        oliList = [select quantity, make_good__c from OpportunityLineItem where opportunityid = :o.id ];
        
        delete oliList; 
    }

}